package com.k.base.jdk.functions;

import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

public class Test {
    public static void main(String[] args) {
        System.out.println("Function 有返回值：");
        Function<String,String> function = a->{
            return "hello:"+a;
        };
        String str = function.apply(" ww");
        System.out.println(str);

        System.out.println("Consumer 无返回值：");
        Consumer<String> consumer = a->{
            System.out.println("hello:"+a);
        };


        Consumer<String> consume2 = b->{
            System.out.println("hello2:"+b);
        };
        consumer.accept("consumer");
        consumer.andThen(consume2);

        Predicate<String> p = Objects::isNull;
        String mya = null;
        System.out.println(p.test(mya));

        Supplier<String> supplier = ()-> "aaa;";
        System.out.println(supplier.get());
    }
}
